|
All this code
does is store the value in each of the four variables left, top, right, and bottom. How does it work?
It starts on the far right-hand side. It sees bottom = 4. So it places the value 4 in the variable bottom, and returns the value it stored in bottom (which is 4). Since bottom = 4 evaluates to 4,
the variable right will also get the value 4,
which means top will also get 4,
which means left will also get 4.
Phew! Of course, this code could have just as easily been written //these four variables represent the sides of
a rectangle int left; int top; int right; int bottom; //make it a square
whose sides are 4 left = 4; top = 4; right = 4; bottom = 4; and it would have done the exact same thing.
The first way is more compact, and you're more likely to see it written the
first way. But both ways are equally correct, so use whichever you prefer.
|